import wx
import sys

from PanelPrincipal import PanelPrincipal
from PanelCadastrar import PanelCadastrar
from PanelCadastrarE import PanelCadastrarE
from PanelComprar import PanelComprar
from PanelRelatorio import PanelRelatorio



class FramePrincipal(wx.Frame):


    def __init__(self, parent, id, title):

        wx.Frame.__init__(self, parent, id, title, size=wx.Size(420, 320))

        

        self.panel = PanelPrincipal(self)

        menubar = wx.MenuBar()

        pessoas = wx.Menu()

        pessoas.Append(1, 'Cartao', '')
        pessoas.Append(2, 'Estabelecimento', '')        
        menubar.Append(pessoas, '&Cadastrar')

        produtos = wx.Menu()

        produtos.Append(3, 'Realizar Compra', '')        
        menubar.Append(produtos, '&Comprar')

        relatorio = wx.Menu()

        relatorio.Append(4, 'Relatorios', '')                
        menubar.Append(relatorio, '&Exibir')

        

        sair = wx.Menu()
        
        sair.Append(5, 'Fechar Programa', '')                
        menubar.Append(sair, '&Sair')



        self.SetMenuBar(menubar)

        self.Bind(wx.EVT_MENU, self.MostrarPanelCadastrar, id=1)
        self.Bind(wx.EVT_MENU, self.MostrarPanelCadastrarE, id=2)
        self.Bind(wx.EVT_MENU, self.MostrarPanelRelatorio, id=4)        
        self.Bind(wx.EVT_MENU, self.MostrarPanelComprar, id=3)
        self.Bind(wx.EVT_MENU, self.FecharPrograma, id=5)
        
        

        self.Centre()

        self.Show(True)



 

    def MostrarPanelCadastrar(self, event):
        self.panel.Hide()
        self.panel = PanelCadastrar(self)
        self.panel.Show()

    def MostrarPanelCadastrarE(self, event):
        self.panel.Hide()
        self.panel = PanelCadastrarE(self)
        self.panel.Show()

    def MostrarPanelComprar(self, event):
        self.panel.Hide()
        self.panel = PanelComprar(self)
        self.panel.Show()


    def MostrarPanelRelatorio(self, event):
        self.panel.Hide()
        self.panel = PanelRelatorio(self)
        self.panel.Show()

        
    def FecharPrograma(self, event):
        self.Close()





app = wx.App()

FramePrincipal(None, -1, ":: BSI Card ::")

app.MainLoop()

input()




